package cn.itcast.mapper;

import cn.itcast.entity.Cast;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CastMapper {
    @Insert("insert into cast (user_name, room_id, user_id, order_id, electricity, wash, create_time, leave_time, money, status) values (#{userName},#{roomId},#{userId},#{orderId},#{electricity},#{wash},#{createTime},#{leaveTime},#{money},#{status})")
    void add(Cast cast);


    void update(Cast cast);

    //分页展示数据
    List<Cast> list(String userName, String roomId);

    @Select("select sum(money) from Cast where user_id=#{userId}")
    Double getMoney(Long userId);
}
